package com.sphd.education.activitys;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.sphd.education.R;
import com.sphd.education.info.MsgInfo;
import com.sphd.education.modle.EducationUrl;

import java.text.SimpleDateFormat;
import java.util.Date;

import butterknife.Bind;
import butterknife.ButterKnife;
/*
* 学校信息详情的展示
* */
public class SchoolMsgsActivity extends AppCompatActivity {

    @Bind(R.id.toolbar)
    Toolbar toolbar;
    @Bind(R.id.tch_image)
    ImageView tchImage;
    @Bind(R.id.tch_name)
    TextView tchName;
    @Bind(R.id.msg_title)
    TextView msgTitle;
    @Bind(R.id.tch_date)
    TextView tchDate;
    @Bind(R.id.tch_org)
    TextView tchOrg;
    @Bind(R.id.msg_content)
    TextView msgContent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_school_msgs);
        ButterKnife.bind(this);
        toolbar.setTitle("消息");
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();//这是自带的箭头的返回的监听
            }
        });
        initView();
    }

    private void initView() {
        Intent intent =getIntent();
        MsgInfo msgInfo = (MsgInfo) intent.getSerializableExtra("schmsg");
        ImageLoader.getInstance().displayImage(EducationUrl.HttpTitle+"/"+msgInfo.getPathUrl(),tchImage,EducationUrl.setImg());
        tchName.setText(msgInfo.getPost() + "-" + msgInfo.getCreatName());
        tchOrg.setText(msgInfo.getOrgName());
        tchDate.setText(new SimpleDateFormat("HH:mm").format(new Date(msgInfo.getCreatTime())));
        msgTitle.setText(msgInfo.getTitle());
        msgContent.setText(msgInfo.getContent());
    }

}
